	function add_new_LSTLNPRD(){
		var LSTLNPRD = document.getElementById('LSTLNPRD').value;	
		var LSTLNPRDlist = document.getElementById('LIST_LSTLNPRD').value;
		var LSTLNPRD_arr = LSTLNPRDlist.split('|');
		var stringLSTLNPRD='';
		var num=0;
		for(i in LSTLNPRD_arr){
			if (LSTLNPRD_arr[i]==LSTLNPRD){
				num=1;
				break;
			}
		}
		if(num==0){
			stringLSTLNPRD = LSTLNPRD;
			document.getElementById('LIST_LSTLNPRD').value = document.getElementById('LIST_LSTLNPRD').value + stringLSTLNPRD +"|";
		}
	}
	
	function delete_LSTLNPRD(){
		var i;
		var num=0;
		var LSTLNPRD = document.getElementById('LSTLNPRD').value;
		var LSTLNPRDlist = document.getElementById('LIST_LSTLNPRD').value;
		var LSTLNPRD_arr = LSTLNPRDlist.split('|');
		
			
		if(LSTLNPRDlist.replace('|','')==LSTLNPRD){
			document.getElementById('LIST_LSTLNPRD').value='';
			num=1;
		}
		if(num==0){
			for(i in LSTLNPRD_arr){
				if(LSTLNPRD_arr[i]==LSTLNPRD){	
					if(LSTLNPRD==''){
					LSTLNPRDlist=LSTLNPRDlist;
					}
					else{
					LSTLNPRDlist = LSTLNPRDlist.replace(LSTLNPRD+'|','');}
				}
			}
			document.getElementById('LIST_LSTLNPRD').value = LSTLNPRDlist;
		}
	}
	/*// Dinh add
		function add_new_LSTSBVCD1(){
		var FDTYPE1 = document.getElementById('FDTYPE1').value;	
		var LSTSBVCD1list = document.getElementById('LIST_LSTSBVCD1').value;
		var LSTSBVCD1_arr = LSTSBVCD1list.split('|');
		var stringLSTSBVCD1='';
		var num=0;
		for(i in LSTSBVCD1_arr){
			if (LSTSBVCD1_arr[i]==FDTYPE1){
				num=1;
				break;
			}
		}
		if(num==0){
			stringLSTSBVCD1 = FDTYPE1;
			document.getElementById('LIST_LSTSBVCD1').value = document.getElementById('LIST_LSTSBVCD1').value + stringLSTSBVCD1 +"|";
		}
	}
	//////
	function delete_LSTSBVCD1(){
		var i;
		var num=0;
		var FDTYPE1 = document.getElementById('FDTYPE1').value;
		var LSTSBVCD1list = document.getElementById('LIST_LSTSBVCD1').value;
		var LSTSBVCD1_arr = LSTSBVCD1list.split('|');

		if(LSTSBVCD1list.replace('|','')==FDTYPE1){
			document.getElementById('LIST_LSTSBVCD1').value='';
			num=1;
		}
		if(num==0){
			for(i in LSTSBVCD1_arr){
				if(LSTSBVCD1_arr[i]==FDTYPE1){	
					if (FDTYPE1==''){
						LSTSBVCD1list = LSTSBVCD1list;
					}
					else{
					LSTSBVCD1list = LSTSBVCD1list.replace(FDTYPE1+'|','');}
				}
			}	
			document.getElementById('LIST_LSTSBVCD1').value = LSTSBVCD1list;
		}
	}*/
	//Dinh Add
	function add_new(id,idlist){
		var id = document.getElementById(id).value;	
		var id_list = document.getElementById(idlist).value;
		var id_arr = id_list.split('|');
		var string_return='';
		var num=0;
		//alert(id);
		for(var i in id_arr){
			if (id_arr[i]==id){
				num=1;
				break;
			}
		}
		if(num==0){
			string_return = id;
			document.getElementById(idlist).value = document.getElementById(idlist).value + string_return +"|";
		}
	}
	
	function deleted(id,idlist){
		var i;
		var num=0;
		var id = document.getElementById(id).value;
		var id_list = document.getElementById(idlist).value;
		var id_arr = id_list.split('|');
		if(id_list.replace('|','')==id){
			document.getElementById(idlist).value='';
			num=1;
		}
		if(num==0){
			for(i in id_arr){
				if(id_arr[i]==id){	
					if(id==''){
						id_list=id_list;
					}
					else{
					id_list = id_list.replace(id+'|','');}
				}
			}
			document.getElementById(idlist).value = id_list;
		}
	}
	
	////////////////
	
	function valbutton_branh(thisform,objname) {
		
		var objradio = thisform.radioTK;
		var radioLength = objradio.length;
		var id, i;
		if(!radioLength){
			id = objradio.value;		
		}else{
			for(i = 0; i < radioLength; i++){
				if(thisform.radioTK[i].checked){
					id = thisform.radioTK[i].value;
					break;
				}
			}
		}
		var name = id.split('-');	
		//alert(objname);
		
		var lblname = objname.split('-');
		var obj1 = window.opener.document.getElementById(lblname[0]);
		var obj2 = window.opener.document.getElementById(lblname[1]);
		var obj3 = window.opener.document.getElementById(lblname[2]);
		if(obj1){
			obj1.value = name[0];
			//var phongtructhuoc = window.opener.document.getElementById("phongtructhuoc");
			//if(phongtructhuoc){
			//	phongtructhuoc.click();	
		//	}
		}
		if(obj2){
			obj2.value = name[1];
		}
		if(obj3){
			obj3.value = name[2];
		}
		window.close();
	}